import DateUtil from "../../engine/DateUtil";
import { Logger } from "../../engine/Logger";
import UIManager from "../../engine/UIManager";
import { RoomConfig } from "../config/RoomConfig";
import { ViewConfig } from "../config/ViewConfig";
import { RoomModel } from "../model/RoomModel";
import { RoomPlayer } from "../model/RoomPlayer";

export class GameManager {

    public static instance:GameManager = new GameManager()

    public checkShowCharge() {
        if (RoomModel.instance.roomType == RoomConfig.Room_Type.Ziyou) {
            RoomModel.instance.lastEndTime = DateUtil.now()
            let myPlayer: RoomPlayer = RoomPlayer.getMyPlayer()
            Logger.log("checkShowCharge", myPlayer.score, RoomModel.instance.conf["minCharge"])
            if (myPlayer.chargeEndTime > 0 && myPlayer.score <= RoomModel.instance.conf["minCharge"]) {
                UIManager.instance.showView(ViewConfig.viewConfig.ViewCheckChargeJinbi, null, myPlayer.chargeEndTime)
            }
        }
    }
}